<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<include file="__VIEW__/Common/header.html"/>
		<!--上传插件uploadify的文件-->
		<script type="text/javascript" src="__STATIC__/uploadify/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
		<link href="__STATIC__/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
		<script type="text/javascript">
			//让上传按钮显示
			function uploadifyShow(){
        			 $('#file').uploadify({
                    'formData'     : {//POST数据
                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
                    },
                    'fileTypeDesc' : '上传文件',//上传描述
                    'fileTypeExts' : '*.jpg;*.png',
                    'swf'      : '__STATIC__/uploadify/uploadify.swf',
                    'uploader' : '{|U:"upload"}',
                    'buttonText':'选择文件',
                    'fileSizeLimit' : '2000KB',
                    'uploadLimit' : 1,//上传文件数
                    'width':65,
                    'height':25,
                    'multi': false,//是否多文件上传
                    'successTimeout':10,//等待服务器响应时间
                    'removeTimeout' : 0.2,//成功显示时间
                    'onUploadSuccess' : function(file, data, response) {
                    	//把变量转为json
                        data=$.parseJSON(data);
                        var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+data.url+"' style='width:200px;' class='img-thumbnail'/><a href='javascript:;' class='del-img'>X</a><input type='hidden' name='logo' value='"+data.path+"' /></li>";
                        $("#uploadList ul").prepend(li);
                        //让删除按钮消失
                        $('.uplodify-box').html('');
                    }
                });
	        }
            $(function(){
            		//刷新页面让上传插件显示
            		uploadifyShow();
            		//点击x，隐藏图片，并且上传按钮显示
	  			$('.del-img').live('click',function(){
	  				//获得当前图片的所在的li，让其消失
	  				$(this).parent('li').hide();
	  				//上传按钮显示
	  				uploadifyShow();
	  				
	  			})
            });
        </script>
	</head>
	<body>
		<form action="" method="post">
		<div class="alert alert-success">添加友情链接</div>
		<div class="form-group">
			<label for="exampleInputEmail1">友情链接名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入友情链接名称"  name="fname">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">友情链接地址</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入友情链接地址"  name="url">
		</div>
		
		<div class="form-group">
			<label for="exampleInputEmail1">友情链接描述</label>
			<textarea name="msg" rows="5" cols=""  class="form-control" placeholder="请输入友情链接描述"></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">排序</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入排序"  name="sort" value="100">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">logo</label>
			  <div lab="uploadFile">
	            <input id="file" type="file" multiple="true">
	            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
	            
	            <div id="uploadList">
	                <ul>
	                </ul>
	            </div>
	        </div>
		</div>
			<div class="form-group">
			<label for="exampleInputEmail1">是否显示</label>
			<br />
			<label class="radio radio-inline" for="radio5">
				<input id="radio5" class="custom-radio" type="radio" data-toggle="radio" value="1" checked="" name="is_show">
				<span class="icons">
				<span class="icon-unchecked"> </span>
				<span class="icon-checked"> </span>
				</span>
				是
			</label>
			<label class="radio  radio-inline" for="radio6">
				<input id="radio6" class="custom-radio" type="radio" data-toggle="radio" value="0" name="is_show">
				<span class="icons">
				<span class="icon-unchecked"> </span>
				<span class="icon-checked"> </span>
				</span>
				否
			</label>
		</div>
		
	    <button class="btn btn-primary btn-block" type="submit"> 确定 </button>
	    </form>
	</body>
</html>
